<layout name='Layout/layout_page' />
	
	<ol class="breadcrumb">
		<li><a href="<{:U('Group/index')}>"><{:L('_menu_user_group')}></a></li>
      	<li class="active"><{:L(_public_list)}></li>
    </ol>


	<div class="row">
		<div class="col-md-12">
			<a class="btn btn-sm btn-info" href="<{:U('Group/add')}>"><i class="icon-plus icon-white"></i> <{:L('_public_add')}></a>
		</div>
	</div>
	
	<p></p>

	<TABLE class="table table-striped table-bordered table-hover">
	  <THEAD>
		<tr>
		  <TH>Name</TH>
		  <TH>Descriptions</TH>
		  <TH>Status</TH>
		  <TH>Action</TH>
		</tr>
	  </THEAD>
	  <TBODY>             
			<volist name="list" id="vo">
			<tr>
			  <td><{$vo.name}></td>
              <td><{$vo.remark}></td>
			  <td><if condition="$vo.status eq 0"><font color="#FF0000">close</font><else />open</if></td>	  
			  <td>
			  	<a href="<{:U('Group/edit' , array('id'=>$vo['id']))}>" class="btn btn-default btn-sm"><i class="glyphicon glyphicon-edit"></i> <{:L("_public_edit")}></a>
			  	<a href="javascript:void(0);" attr="delaccount_<{$vo['id']}>" class="btn btn-default btn-sm"><i class="glyphicon glyphicon-trash"></i> <{:L('_public_del')}></a>
			  	<a href="<{:U('Group/competence',array('id'=>$vo['id']))}>" class="btn btn-info btn-sm"><i class='glyphicon glyphicon-asterisk icon-white'></i> Authority</a>
			  </td>
			</tr>
			</volist>
	  </TBODY>
	</TABLE>

<script type="text/javascript">
$(document).ready(function() {
	$("a[attr^='delaccount_']").each(function(){
		var tmp = $(this).attr('attr').split('_');
		$(this).bind("click",function(){			
			var dialog = art.dialog({				
				content:'Can not be restored after the deletion, confirm it?',
				ok:function(){
					this.content('deleting');
					$.ajax({
						url: "<{:U('Group/del')}>&id="+tmp[1]+"&temp="+new Date().getTime(),
						success: function (data) {
							if(data==1){
							window.location.href = "<{:U('Group/index')}>";
							}else{	
								dialog.content('<{:L('_action_fail')}>').time(2);
							}
						},
					});
                	return false;
					},	
				lock : true,
			});	
		});
	});
});
</script>

<input type="hidden" id="menu_action" value="sys" />
